package org.lboot.ufos.test;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import org.lboot.ufos.client.S3Client;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("s3")
@AllArgsConstructor
@Api(tags = "存储源测试")
public class S3OssTestController {
    S3Client s3Client;

    @PostMapping("switch/{oss}")
    @ApiOperation(value = "切换存储")
    public Object switchOss(@PathVariable("oss") String oss){
        log.info(oss);
        if (oss.equals("qiniu")){
            s3Client.reload("qiniu.properties");
            return "重置成功";
        }else if(oss.equals("minio")){
            s3Client.reload("minio.properties");
            return "重置成功";
        }
        return "未找到!";
    }
}
